Skip to content

feat: add secure admin payment dashboard - #17

Merged
udaycodespace merged 2 commits into
udaycodespace:mainfrom
Jidnyasa-P:feat/issue-9-admin-payment-dashboard
Jul 18, 2026
Merged

feat: add secure admin payment dashboard#17
udaycodespace merged 2 commits into
udaycodespace:mainfrom
Jidnyasa-P:feat/issue-9-admin-payment-dashboard

Conversation

@Jidnyasa-P

@Jidnyasa-P Jidnyasa-P commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Description

Adds a secure admin payment-records dashboard with sanitized transaction data, summary metrics, filtering, sorting, pagination, responsive layouts, and an accessible details dialog.

Fixes #9

Backend changes

  • Replaced the raw payment-document response with a strict sanitized DTO

  • Added search by:

    • Transaction ID
    • Student name
    • Student email
    • Course title
  • Added payment-status filtering

  • Added start and end date filtering

  • Added newest and oldest sorting

  • Added amount sorting

  • Added validated pagination and page size

  • Added aggregate summary metrics

  • Corrected course population to use C_title and C_price

  • Added compatibility for legacy enrolled payment statuses

  • Escaped regex search input

  • Protected the endpoint using existing admin authentication and role middleware

Frontend changes

  • Added a Payments section to the admin dashboard

  • Added summary cards for:

    • Total transactions
    • Successful transactions
    • Pending and failed transactions
    • Total mock revenue
  • Added responsive desktop and mobile transaction layouts

  • Added search and filter controls

  • Added date filtering

  • Added newest/oldest and amount sorting

  • Added configurable page size

  • Added pagination controls

  • Added loading skeletons

  • Added empty and retryable error states

  • Added an accessible transaction-detail dialog

Security

The API and frontend do not expose:

  • Full card numbers
  • CVV values
  • Card expiry values
  • Passwords
  • Authentication tokens
  • Raw card-detail objects

Only a masked card identifier may be returned.

Documentation

Added docs/admin-payment-records.md with:

  • API usage
  • Query parameters
  • Status normalization
  • Security behaviour
  • Testing instructions

Testing

  • Verified admin-only access
  • Verified unauthorized requests are rejected
  • Verified non-admin users are rejected
  • Tested transaction search
  • Tested status filtering
  • Tested date filtering
  • Tested invalid date ranges
  • Tested newest/oldest sorting
  • Tested amount sorting
  • Tested pagination
  • Tested summary metrics
  • Tested loading, empty, and error states
  • Tested mobile and desktop layouts
  • Tested transaction-detail dialog
  • Confirmed sensitive fields are absent from API responses
  • Ran backend syntax checks
  • Ran frontend production build

Screenshots

Screenshot 2026-07-18 185159 Screenshot 2026-07-18 185245 Screenshot 2026-07-18 185258 Screenshot 2026-07-18 185401 Screenshot 2026-07-18 185413 Screenshot 2026-07-18 185448 Screenshot 2026-07-18 185458 Screenshot 2026-07-18 185505 Screenshot 2026-07-18 185513

@Jidnyasa-P

Copy link
Copy Markdown
Contributor Author

@udaycodespace Do add bonus labels like good-backend , good-pr , good-ui

@udaycodespace
udaycodespace self-requested a review July 18, 2026 13:39
@udaycodespace udaycodespace added ECSoC26 Required label for a PR to be eligible for Sentinel scoring ECSoC26-L1 Easy difficulty, auto-assigned by Sentinel — 5 points and removed frontend documentation backend labels Jul 18, 2026
@udaycodespace

Copy link
Copy Markdown
Owner

@udaycodespace Do add bonus labels like good-backend , good-pr , good-ui

Temporary labels have been assigned based on the PR description. Final labels will be assigned after the review.

Also, since the PR includes an extensive testing checklist, please share the relevant testing evidence (terminal output/screenshots where applicable), such as:

  • Backend syntax check results
  • Frontend production build output
  • Sample API responses demonstrating admin authorization and sanitized data
  • Verification of filtering, sorting, pagination, and summary metrics

This helps with validating the implementation during the review. Thanks!

@udaycodespace udaycodespace added ECSoC26-L3 Difficult, auto-assigned by Sentinel — 15 points good-ui PA-awarded bonus for outstanding UI/UX work — +25 XP and removed ECSoC26-L1 Easy difficulty, auto-assigned by Sentinel — 5 points labels Jul 18, 2026
@udaycodespace udaycodespace added the redo Reviewed — needs changes before it can be merged label Jul 18, 2026
@Jidnyasa-P

Copy link
Copy Markdown
Contributor Author

@udaycodespace Thanks for the review. I have completed the requested validation and added the relevant testing evidence below.

Backend validation

  • node --check controllers/paymentRecordsController.js — passed
  • node --check routers/adminRoutes.js — passed
  • Backend started successfully and connected to MongoDB
Screenshot 2026-07-18 193454

Frontend production build

  • npm run build — completed successfully
Screenshot 2026-07-18 193535

Admin authorization

  • Admin token request returned 200 OK
  • Request without a token returned 401 Unauthorized
  • Request using a non-admin account returned 403 Forbidden
Screenshot 2026-07-18 193755 Screenshot 2026-07-18 193803

Sanitized payment response

Screenshot 2026-07-18 193922

Filters and sorting

Verified:

  • Search by student email, transaction ID, and course title
  • Successful, pending, and failed status filters
  • Start and end date filters
  • Newest and oldest sorting
  • Amount ascending and descending sorting
Screenshot 2026-07-18 194044 Screenshot 2026-07-18 194049 Screenshot 2026-07-18 194105

Pagination

Verified page-size selection and Previous/Next navigation using multiple transaction records.

Screenshot 2026-07-18 194117 Screenshot 2026-07-18 194148

Summary metrics

Verified that total transactions, status counts, and successful mock revenue shown in the frontend match the API summary response.

Screenshot 2026-07-18 185448 Screenshot 2026-07-18 185458 Screenshot 2026-07-18 185505 Screenshot 2026-07-18 185513

I have also included the frontend ss in the PR.

@udaycodespace udaycodespace added in review PR is up and waiting on maintainer review and removed redo Reviewed — needs changes before it can be merged labels Jul 18, 2026
@udaycodespace

Copy link
Copy Markdown
Owner

@udaycodespace Thanks for the review. I have completed the requested validation and added the relevant testing evidence below.

Backend validation

  • node --check controllers/paymentRecordsController.js — passed
  • node --check routers/adminRoutes.js — passed
  • Backend started successfully and connected to MongoDB
Screenshot 2026-07-18 193454 ### Frontend production build * `npm run build` — completed successfully Screenshot 2026-07-18 193535 ### Admin authorization * Admin token request returned `200 OK` * Request without a token returned `401 Unauthorized` * Request using a non-admin account returned `403 Forbidden`

Screenshot 2026-07-18 193755 Screenshot 2026-07-18 193803

Sanitized payment response

Screenshot 2026-07-18 193922 ### Filters and sorting Verified:
  • Search by student email, transaction ID, and course title
  • Successful, pending, and failed status filters
  • Start and end date filters
  • Newest and oldest sorting
  • Amount ascending and descending sorting

Screenshot 2026-07-18 194044 Screenshot 2026-07-18 194049 Screenshot 2026-07-18 194105

Pagination

Verified page-size selection and Previous/Next navigation using multiple transaction records.

Screenshot 2026-07-18 194117 Screenshot 2026-07-18 194148

Summary metrics

Verified that total transactions, status counts, and successful mock revenue shown in the frontend match the API summary response.

Screenshot 2026-07-18 185448 Screenshot 2026-07-18 185458 Screenshot 2026-07-18 185505 Screenshot 2026-07-18 185513
I have also included the frontend ss in the PR.

lgtm!

@udaycodespace udaycodespace added good-pr PA-awarded bonus for an exceptionally executed PR — +15 XP good-backend PA-awarded bonus for outstanding backend work — +50 XP and removed in review PR is up and waiting on maintainer review labels Jul 18, 2026
udaycodespace pushed a commit that referenced this pull request Jul 18, 2026
Merge PR #17 from Jidnyasa-P

Add a secure admin payment dashboard with payment management features.

Highlights:
- Add admin payment records dashboard
- Sanitize API responses to protect sensitive payment data
- Add search, filtering, sorting, and pagination
- Display payment summary metrics
- Support responsive desktop and mobile layouts
- Add accessible transaction details dialog
- Protect endpoints with admin authentication and authorization
- Add documentation for the payment records API
- Include testing validation and build verification

Closes #9.
@udaycodespace

Copy link
Copy Markdown
Owner

@Jidnyasa-P I went through the code for PR #16, everything looked good, so I merged it.

For PR #17, the latest changes from main have introduced merge conflicts. Please sync your branch with the latest main, resolve the conflicts, and push the updated changes. Once that's done, just ping me here and I'll merge it.

@udaycodespace udaycodespace added the redo Reviewed — needs changes before it can be merged label Jul 18, 2026
@Jidnyasa-P

Copy link
Copy Markdown
Contributor Author

@Jidnyasa-P I went through the code for PR #16, everything looked good, so I merged it.

For PR #17, the latest changes from main have introduced merge conflicts. Please sync your branch with the latest main, resolve the conflicts, and push the updated changes. Once that's done, just ping me here and I'll merge it.

Done

@udaycodespace udaycodespace added in review PR is up and waiting on maintainer review and removed frontend documentation backend redo Reviewed — needs changes before it can be merged in review PR is up and waiting on maintainer review labels Jul 18, 2026
@udaycodespace
udaycodespace merged commit 32bc3d4 into udaycodespace:main Jul 18, 2026
3 checks passed
@ecsoc-sentinel ecsoc-sentinel Bot added ECSoC26-L2 Medium difficulty, auto-assigned by Sentinel — 10 points and removed ECSoC26-L3 Difficult, auto-assigned by Sentinel — 15 points labels Jul 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ECSoC26-L2 Medium difficulty, auto-assigned by Sentinel — 10 points ECSoC26 Required label for a PR to be eligible for Sentinel scoring good-backend PA-awarded bonus for outstanding backend work — +50 XP good-pr PA-awarded bonus for an exceptionally executed PR — +15 XP good-ui PA-awarded bonus for outstanding UI/UX work — +25 XP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add admin payment records dashboard with safe transaction details

2 participants